﻿NSFile("Gianduia.AppKit.NSDynamicElement", function () {
    NSImport("Gianduia.AppKit.NSComponent");
    NSClass("Gianduia.AppKit.NSDynamicElement").Extends("Gianduia.AppKit.NSComponent").Implements({
        "+load": function () {
            if (this === Gianduia.AppKit.NSDynamicElement) {
                this.prototype.superInitWithOwnerComponentDeclarationParentComponent = this.prototype.superMethodNamed("initWithOwnerComponentDeclarationParentComponent");
                this.prototype._templateInsertionMode = this.prototype.NSTemplateInsertionModeIgnore;
                this.prototype.setValueForUndefinedKey = this.prototype.setElementValueForKey;
                this.prototype.valueForUndefinedKey = this.prototype.elementValueForKey
            }
        }, elementTagName: NSProperty(), elementAttributesBuffer: NSProperty(), _hasTemplate: false, "+hasTemplate": function () {
            return false
        }, createElement: function () {
            return document.createElement(this.elementTagName())
        }, willCreateComponentWithDeclarationElement: function (B, A) {
            if (this.shouldCreateElementFromElement(A)) {
                return this.createElement()
            } return A
        }, template: function () {
            var A = this.elementTagName();
            if (this.shouldCreateElementFromElement(this._element)) {
                this._templateInsertionMode = this.NSTemplateInsertionModeReplace;
                return this.createElement()
            } else {
                this._templateInsertionMode = this.NSTemplateInsertionModeIgnore;
                return null
            }
        }, shouldCreateElementFromElement: function (A) {
            var B = this.elementTagName();
            return (B != null && (A.tagName.uppercaseString() !== B.uppercaseString()))
        }, _templateInsertionMode: this.NSTemplateInsertionModeIgnore
    })
});
